﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Aandelendelen.Controls
{
	public partial class AuthenticationRequiredBaseUserControl : BaseUserControl
	{
		protected bool AsAdvertiser = false;

		protected override void PreLoadHandler(object sender, EventArgs e)
		{
			this.CheckLoggedIn();
		}

		protected void CheckLoggedIn()
		{
			bool loggedIn = (this.UserInfo != null);

			if (loggedIn)
			{
				if (this.AsAdvertiser && this.UserInfo.IsAdvertiser == false)
					Response.Redirect("/Home.aspx", true);
			}
			else
				Response.Redirect("/Expired.aspx", true);
		}
	}
}